<?xml version="1.0" encoding="UTF-8"?>
<!--
  Created by IntelliJ IDEA.
  User: imon
  Date: 2/18/13
  Time: 9:06 PM
-->
<ui:composition template="/templates/layout.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <ui:define name="title">
        <title>FundRaiser-Active Issues</title>
    </ui:define>


    <ui:define name="content">

        <h:form id="menu">
            <p:tabMenu activeIndex="1">

                <p:menuitem value="Pending Issues" action="#{adminHomeController.showPendingIssue}"/>
                <p:menuitem value="Active Issues" action="#{adminHomeController.showActiveIssue}"/>
                <p:menuitem value="Closed Issues" action="#{adminHomeController.showClosedIssue}"/>
            </p:tabMenu>
        </h:form>

        <c:choose>
            <c:when test="#{not empty activeIssueController.activeIssues}">
                <p:accordionPanel dynamic="false" cache="true" value="#{activeIssueController.activeIssues}"
                                  var="activeIssue">
                    <p:tab title="#{activeIssue.title}">
                        <h:panelGrid columns="2">
                            <h:outputLabel value="Help For : "/>
                            <h:outputText value="#{activeIssue.helpFor}"/>
                            <h:outputLabel value="Description : "/>
                            <h:outputText escape="false" value="#{activeIssue.description}"/>
                            <h:outputLabel value="Creation Date : "/>
                            <h:outputText value="#{activeIssue.createdDate}"/>
                            <p:spacer/>
                            <p:commandButton action="#{activeIssueController.closeIssue(activeIssue.issueId)}"
                                             value="Close"/>
                        </h:panelGrid>
                    </p:tab>
                </p:accordionPanel>
            </c:when>
            <c:otherwise>
                <p:panel>
                    <f:facet name="header">
                        Active Issues
                    </f:facet>
                    <p:outputLabel>
                        No Active Issue Found
                    </p:outputLabel>
                </p:panel>
            </c:otherwise>
        </c:choose>

    </ui:define>

</ui:composition>